import request from '@/utils/request'

export  function exportUserList() {
  return request({
    url: 'api/Excel/ExportUserList',
    method: 'get',
    responseType: "arraybuffer",
  })
}
export function getSystemPageList(userId,opObject,opType,startTime,endTime,log,index,size,order,asc) {
  return request({
    url: '/api/OpsysLog/GetSystemPageList',
    method: 'get',
    params: { userId,opObject,opType,startTime,endTime,log,index,size,order,asc }
  })
}

export function getRolePageList(index,size) {
  return request({
    url: '/api/OpSysRole/GetRolePageList',
    method: 'get',
    params: { index,size }
  })
}

export function getUserPageList(nickName,account,index,size) {
  return request({
    url: '/api/OpUser/GetPageList',
    method: 'get',
    params: { nickName,account,index,size }
  })
}

export function GetUserInfo() {
  return request({
    url: '/api/OpUser/GetUserInfo',
    method: 'get',
    params: { }
  })
}

export function getUserCustomerPageList(userId,index,size) {
  return request({
    url: '/api/OpUserCustomer/GetPageListById',
    method: 'get',
    params: { userId,index,size }
  })
}

export function GetUnBindCustomerListById(userId,index,size) {
  return request({
    url: '/api/OpUserCustomer/GetUnBindCustomerListById',
    method: 'get',
    params: { userId,index,size }
  })
}

export function createRole(data) {
  return request({
    url: '/api/OpSysRole/Create',
    method: 'post',
    data
  })
}

export function getPermissionPageList(index,size,menuName,path) {
  return request({
    url: '/api/OpSysPermission/GetPageList',
    method: 'get',
    params: { index,size,menuName,path }
  })
}

export function createPermission(data) {
  return request({
    url: '/api/OpSysPermission/Create',
    method: 'post',
    data
  })
}

export function updatePermission(data) {
  return request({
    url: 'api/OpSysPermission/Update',
    method: 'post',
    data
  })
}

export function deletePermission(permissionId) {
  return request({
    url: '/api/OpSysPermission/Delete',
    method: 'post',
    params:{permissionId}
  })
}

export function getRolePermissionList(roleId) {
  return request({
    url: 'api/OpSysPermission/GetRolePermissionList',
    method: 'get',
    params: { roleId }
  })
}

export function GetRoleNotPermissionList(roleId) {
  return request({
    url: '/api/OpSysPermission/GetRoleNotPermissionList',
    method: 'get',
    params: { roleId }
  })
}

export function AppendRolePermission(roleId,data) {
  return request({
    url: 'api/OpSysPermission/AppendRolePermission',
    method: 'post',
    params: { roleId },
    data
  })
}

export function DeleteRolePermission(roleId,data) {
  return request({
    url: 'api/OpSysPermission/DeleteRolePermission',
    method: 'post',
    params: { roleId },
    data
  })
}

export function OpSysRoleGetRoleList() {
  return request({
    url: 'api/OpSysRole/GetRoleList',
    method: 'get'
  })
}

export function OpUserUpdate(data) {
  return request({
    url: 'api/OpUser/Update',
    method: 'post',
    data
  })
}

export function OpUserCreate(data) {
  return request({
    url: 'api/OpUser/Create',
    method: 'post',
    data
  })
}

export  function OpUserDelete(editUserId) {
  return request({
    url: 'api/OpUser/Delete',
    method: 'delete',
    params: { editUserId }
  })
}

export function OpUserCustomerAppendById(userId,data) {
  return request({
    url: 'api/OpUserCustomer/AppendById',
    method: 'post',
    params: { userId },
    data
  })
}

export function OpUserCustomerRemoveById(userId,data) {
  return request({
    url: 'api/OpUserCustomer/RemoveById',
    method: 'delete',
    params: { userId },
    data
  })
}

export function OpSysRoleDelete(roleId) {
  return request({
    url: 'api/OpSysRole/Delete',
    method: 'post',
    params: { roleId }
  })
}


export function updateUerInfo(data) {
  return request({
    url: '/api/OpUser/Update',
    method: 'post',
    data
  })
}

export function ModifyPassWord(oldPassWord,newPassWord) {
  return request({
    url: '/api/OpUser/ModifyPassWord',
    method: 'post',
    params:{ oldPassWord,newPassWord }
  })
}
